package common.vo;

public class R {
    private int code;
    private String msg;
    private Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static R getR(int c,String m,Object d){
        R r= new R();
        r.setCode(c);
        r.setData(d);
        r.setMsg(m);
        return r;
    }
    public static R ok(){
        return getR(200,"OK",null);
    }
    public static R ok(Object data){
        return getR(200,"OK",data);
    }
    public static R fail(){
        return getR(400,"FAIL",null);
    }
    public static R fail(String msg){
        return getR(400,msg,null);
    }
}
